<!DOCTYPE html>
<html lang="Zh-cn">
<head>
	<meta charset="UTF-8">
	<meta name="format-detection" content="telephone=no" />
	<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=no"/>
	<title>Surprise</title>
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<script type="text/javascript" src="js/zepto.min.js"></script>
	<script type="text/javascript" src="js/surprise.js"></script>
	<script type="text/javascript" src="http://libs.useso.com/js/jquery/1.9.0/jquery.min.js"></script>
	<script type="text/javascript">
		function is_weixin() {
		    var ua = navigator.userAgent.toLowerCase();
		    if (ua.match(/MicroMessenger/i) == "micromessenger") {
		        return true;
		    } else {
		        return false;
		    }
		}
		function subgo(event) {
			$.ajax({
			    type: "post",
			    url: '/api/addLike',
			    dataType: 'json',
			    data: {
				productid: $('#productidHidden').val(),
				userid: 0
			    },
			    success: function () {
				var isWeixin = is_weixin();
				if(isWeixin){
					var winHeight = typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight;
					var weixinTip = $('<div id="weixinTip"><p><img src="images/weixin-tip.png" alt="微信打开"/></p></div>');
					$("body").append(weixinTip);
					$("#weixinTip").css({
						"position":"fixed",
						"left":"0",
						"top":"0",
						"height":"auto",
						"width":"auto",
						"z-index":"100",
						"background-color":"rgba(0,0,0,0.8)",
						"opacity":"0.8",
						"filter":"alpha(opacity=80)",
					});
					$("#weixinTip p").css({
						"text-align":"center",
						"position":"relative"
					});
				} else {
					window.location.href = $("#urlHidden").val();
				}
			    }
			});
		}
	</script>
</head>
<body>
    <template id="shopInfo">
        <div class="container">
            <div class="mainImg" id="mainImg">
                <img src="${pic}">
            </div>
            <!--<div class="shopIntro">
                <h3>${productName}</h3>
                <p>${introduction}</p>
            </div>-->
        </div>
	<div class="fixedbottom">
		<div class="fixeddownload">
			<a href="#" id="urlClick" onclick="subgo()">前往购买</a>
		</div>
	</div>
	<input type="hidden" id="urlHidden" name="url" value=${productUrl}>
	<input type="hidden" id="productidHidden" name="productid" value=${id}>
    </template>
</body>
</html>
